﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:Wpf="clr-namespace:Sentinel.Support.Wpf"
             x:Class="Sentinel.Classification.Gui.ClassificationsControl"
             mc:Ignorable="d">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
            <ColumnDefinition Width="80" />
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0"
                    Grid.Column="0"
                    Grid.RowSpan="4"
                    Orientation="Vertical"
                    VerticalAlignment="Center">
            <Button Command="{Binding Classifier.OrderEarlier}"
                    Margin="5"
                    Content="Up"/>
            <Button Command="{Binding Classifier.OrderLater}"
                    Margin="5"
                    Content="Down"/>
        </StackPanel>
        <ListView Grid.Row="0"
                  SelectedIndex="{Binding Classifier.SelectedIndex, Mode=OneWayToSource}"
                  Grid.Column="1"
                  Grid.RowSpan="4"
                  MinHeight="200"
                  ItemsSource="{Binding Classifier.Classifiers}"
                  SelectionMode="Single">
            <ListView.View>
                <GridView>
                    <Wpf:FixedWidthColumn FixedWidth="28">
                        <Wpf:FixedWidthColumn.HeaderTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="True"
                                          IsEnabled="False"
                                          ToolTipService.ShowOnDisabled="True"
                                          ToolTip="Is the classifier enabled?" />
                            </DataTemplate>
                        </Wpf:FixedWidthColumn.HeaderTemplate>
                        <Wpf:FixedWidthColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="{Binding Enabled}"
                                          Margin="2,3,0,3" />
                            </DataTemplate>
                        </Wpf:FixedWidthColumn.CellTemplate>
                    </Wpf:FixedWidthColumn>
                    <GridViewColumn Header="Name"
                                    DisplayMemberBinding="{Binding Name}" />
                    <GridViewColumn Header="Type"
                                    DisplayMemberBinding="{Binding Type}" />
                    <GridViewColumn Header="Field"
                                    DisplayMemberBinding="{Binding Field}" />
                    <GridViewColumn Header="Mode"
                                    DisplayMemberBinding="{Binding Mode}" />
                    <GridViewColumn Header="Description"
                                    DisplayMemberBinding="{Binding Description}" />
                </GridView>
            </ListView.View>
        </ListView>
        <Button Content="_Add"
                Command="{Binding Classifier.Add}"
                Grid.Row="0"
                Margin="5,0,5,5"
                Grid.Column="2" />
        <Button Content="_Edit"
                Command="{Binding Classifier.Edit}"
                Grid.Row="1"
                Margin="5,0,5,5"
                Grid.Column="2" />
        <Button Content="_Remove"
                Command="{Binding Classifier.Remove}"
                Grid.Row="2"
                Margin="5,0,5,5"
                Grid.Column="2" />
    </Grid>
</UserControl>